<template>
  <teleport to="#modal">
    <div class="box">
      {{ msg }}
    </div>
  </teleport>
</template>

<script lang="ts">
import { ref } from "vue";
export default {
  name: "modal",
  setup() {
    return {
      msg: ref("一切为了人民"),
    };
  },
};
</script>

<style scoped>
.box {
  width: 200px;
  height: 200px;
  border: 1px solid #ccc;
  background-color: #f5f5f5;
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
</style>
